package cn.gogoyc.system.service.impl;

import cn.gogoyc.org.basic.servie.impl.BaseServiceImpl;
import cn.gogoyc.org.basic.util.PageList;
import cn.gogoyc.system.domain.SystemDictionaryDetail;
import cn.gogoyc.system.mapper.SystemDictionaryDetailMapper;
import cn.gogoyc.system.query.DictionaryDetailQuery;
import cn.gogoyc.system.service.SystemDictionaryDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * The interface System dictionary detail service.
 * @author L1vezZ
 */
@Service
public class SystemDictionaryDetailServiceImpl extends BaseServiceImpl<SystemDictionaryDetail> implements SystemDictionaryDetailService {
    @Autowired
    private SystemDictionaryDetailMapper mapper;

    @Override
    public void findTypeIdDel(Long TypeId) {
        mapper.findTypeIdDel(TypeId);
    }

    @Override
    public List<SystemDictionaryDetail> getDetails(Long id) {
        return mapper.getDetails(id);
    }

    @Override
    public PageList<SystemDictionaryDetail> queryPage2(DictionaryDetailQuery query) {
        //个数为0返回个空数据载体给前端
        if (mapper.queryCount2(query) == 0) {
            return new PageList<>();
        }
        //个数不等于0将数据返回给前端
        return new PageList<>(mapper.queryData2(query),mapper.queryCount2(query));
    }
}
